
package View;

import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 *
 * @author CCD gruppe 2
 */
public class ProjectInfoPanel extends javax.swing.JPanel {

    private javax.swing.JButton addProjectUsersButton;
    private javax.swing.JLabel chosenUsersLabel;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JButton createProjectButton;
    private javax.swing.JTextArea projectDescTextArea;
    private javax.swing.JLabel projectDescriptionLabel;
    private javax.swing.JLabel projectGoalLabel;
    private javax.swing.JTextArea projectGoalTextArea;
    private javax.swing.JComboBox projectLeaderDropDown;
    private javax.swing.JLabel projectLeaderLabel;
    private javax.swing.JLabel projectNameLabel;
    private javax.swing.JTextField projectNameTextField;
    private javax.swing.JLabel projectUsersLabel;
    private javax.swing.JButton removeUserButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JList addedUsersList;
    private DefaultComboBoxModel leaderDropDownModel;
    private DefaultListModel addedUserListModel;

    /** Creates new form ProjectInfoPanel */
    public ProjectInfoPanel() {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        jSeparator1 = new javax.swing.JSeparator();
        chosenUsersLabel = new javax.swing.JLabel();
        createProjectButton = new javax.swing.JButton();
        projectUsersLabel = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        projectDescTextArea = new javax.swing.JTextArea();
        projectLeaderDropDown = new javax.swing.JComboBox();
        projectLeaderLabel = new javax.swing.JLabel();
        addProjectUsersButton = new javax.swing.JButton();
        projectGoalLabel = new javax.swing.JLabel();
        removeUserButton = new javax.swing.JButton();
        projectNameTextField = new javax.swing.JTextField();
        projectDescriptionLabel = new javax.swing.JLabel();
        projectNameLabel = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        projectGoalTextArea = new javax.swing.JTextArea();
        leaderDropDownModel = new DefaultComboBoxModel();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        addedUsersList = new javax.swing.JList();
        addedUserListModel = new DefaultListModel();
        addedUsersList.setModel(addedUserListModel);

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
        chosenUsersLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        chosenUsersLabel.setText("Valgte brukere:");

        projectLeaderDropDown.setModel(leaderDropDownModel);
        createProjectButton.setText("Opprett");

        projectUsersLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        projectUsersLabel.setText("Brukere:");

        projectDescTextArea.setColumns(20);
        projectDescTextArea.setLineWrap(true);
        projectDescTextArea.setRows(5);
        projectDescTextArea.setWrapStyleWord(true);
        jScrollPane1.setViewportView(projectDescTextArea);


        projectLeaderLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        projectLeaderLabel.setText("Prosjektleder:");

        addProjectUsersButton.setText("Legg til brukere");

        projectGoalLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        projectGoalLabel.setText("Mål:");

        removeUserButton.setText("Fjern");

        projectDescriptionLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        projectDescriptionLabel.setText("Beskrivelse:");

        projectNameLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        projectNameLabel.setText("Navn:");

        projectGoalTextArea.setColumns(20);
        projectGoalTextArea.setLineWrap(true);
        projectGoalTextArea.setRows(5);
        projectGoalTextArea.setWrapStyleWord(true);
        jScrollPane2.setViewportView(projectGoalTextArea);

        jLabel1.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel1.setText("Valgte deltakere:");

        jScrollPane3.setViewportView(addedUsersList);


        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(projectGoalLabel)
                    .add(projectDescriptionLabel)
                    .add(projectNameLabel)
                    .add(jScrollPane1)
                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
                    .add(projectNameTextField))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(createProjectButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
                    .add(addProjectUsersButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
                    .add(jLabel1)
                    .add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(projectNameLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(projectNameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(projectDescriptionLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(projectGoalLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 169, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(28, 28, 28))
            .add(layout.createSequentialGroup()
                .add(28, 28, 28)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                        .add(jLabel1)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE)
                        .add(18, 18, 18)
                        .add(addProjectUsersButton)
                        .add(18, 18, 18)
                        .add(createProjectButton))
                    .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 429, Short.MAX_VALUE))
                .addContainerGap())
        );
    }// </editor-fold>


    /**
     * A method that clears the input
     */
    public void clearInput(){
        projectDescTextArea.setText("");
        projectNameTextField.setText("");
        addedUserListModel.clear();
        projectGoalTextArea.setText("");
    }

    /**
     * A method that sets the textfields and areas non-focusable.
     */
    public void isInfoPanel(){
        this.projectNameTextField.setFocusable(false);
        this.projectDescTextArea.setFocusable(false);
        this.projectGoalTextArea.setFocusable(false);

    }

    /**
     * A method that sets the textfields and areas focusable.
     */
    public void editButtonPressed(){
        this.projectNameTextField.setFocusable(true);
        this.projectDescTextArea.setFocusable(true);
        this.projectGoalTextArea.setFocusable(true);
    }

    /*
     * Getters and setters
     */

    public JButton getAddProjectUsersButton() {
        return addProjectUsersButton;
    }

    public JLabel getChosenUsersLabel() {
        return chosenUsersLabel;
    }

    public JScrollPane getjScrollPane1() {
        return jScrollPane1;
    }

    public JScrollPane getjScrollPane2() {
        return jScrollPane2;
    }

    public JSeparator getjSeparator1() {
        return jSeparator1;
    }

    public JButton getCreateProjectButton() {
        return createProjectButton;
    }

    public JTextArea getProjectDescTextArea() {
        return projectDescTextArea;
    }

    public JLabel getProjectDescriptionLabel() {
        return projectDescriptionLabel;
    }

    public JLabel getProjectGoalLabel() {
        return projectGoalLabel;
    }

    public JTextArea getProjectGoalTextArea() {
        return projectGoalTextArea;
    }

    public JComboBox getProjectLeaderDropDown() {
        return projectLeaderDropDown;
    }

    public JLabel getProjectLeaderLabel() {
        return projectLeaderLabel;
    }

    public DefaultListModel getAddedUserListModel() {
        return addedUserListModel;
    }

    public JLabel getProjectNameLabel() {
        return projectNameLabel;
    }

    public JTextField getProjectNameTextField() {
        return projectNameTextField;
    }

    public JLabel getProjectUsersLabel() {
        return projectUsersLabel;
    }

    public JButton getRemoveUserButton() {
        return removeUserButton;
    }

    public DefaultComboBoxModel getLeaderDropDownModel() {
        return leaderDropDownModel;
    }

    public JList getAddedUsersList() {
        return addedUsersList;
    }
    
}

